{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Updating the Tutorial Notebooks"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "You can use the provided [**igz-tutorials-get.sh**](./igz-tutorials-get.sh) script to get updated platform tutorials from the [tutorials GitHub repository](https://github.com/v3io/tutorials/).\n",
    "By default, the script retrieves the files from the latest release that matches the current platform version.\n",
    "The files are copied to the **/v3io/users/&lt;username&gt;** directory, where `<username>` is the name of the running user (`$V3IO_USERNAME`) unless you pass another username as an argument to the script.\n",
    "\n",
    "> **Note:**\n",
    "> - Before running the script, close all GitHub tutorial files that might be updated, including all tutorial notebooks and other files.<br>\n",
    ">   The script doesn't overwrite the current notebook (**update-tutorials.ipynb**) and the **igz-tutorials-get.sh** script nor any custom file or directory that you created.\n",
    "> - You can use the `--dry-run` flag to list the files to update without copying any files to the platform.\n",
    "> - You can override the default Git branch for the update by setting the `-b|--branch` flag to a specific branch name.\n",
    ">   When using this option, ensure that the files in the specified branch match your version of the platform.\n",
    ">   If in doubt, consult Iguazio's [customer-success team](mailto:support@iguazio.com)."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "For full usage instructions, run the script with the `-h` or `--help` flag:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "igz-tutorials-get.sh:\n",
      "Retrieves updated Iguazio Data Science Platform tutorial files from the v3io/tutorials GitHub repository.\n",
      "USAGE: igz-tutorials-get.sh [OPTIONS] [<username>]\n",
      "PARAMETERS:\n",
      "  <username> -  Username, which determines the directory to which to copy the\n",
      "                retrieved files (/v3io/users/<username>).\n",
      "                Default: $V3IO_USERNAME, if set to a non-empty string.\n",
      "OPTIONS:\n",
      "  -h|--help   -  Display this message and exit.\n",
      "  -b|--branch -  Git branch name. Default: The latest release branch that\n",
      "                 matches the current platform version.\n",
      "  --dry-run   -  Show files to update but don't execute the update.\n"
     ]
    }
   ],
   "source": [
    "!/User/igz-tutorials-get.sh --help"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "To update the tutorial notebooks in your user home directory, simply run the following code:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Detected platform version: 3.0\n",
      "Detected https://github.com/v3io/tutorials.git tag: v3.0.0\n",
      "Updating Iguazio Data Science Platform tutorial files of branch v3.0.0 to '/v3io/users/temp_demo'...\n",
      "Copying to temporary directory '/tmp/temp-igz-tutorials.kJp36GqLCe'...\n",
      "Copying files to '/v3io/users/temp_demo'...\n",
      "Deleting temporary directory '/tmp/temp-igz-tutorials.kJp36GqLCe'...\n",
      "DONE\n"
     ]
    }
   ],
   "source": [
    "!/User/igz-tutorials-get.sh"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
